package com.techstar.ats.netty.handler;

import lombok.extern.slf4j.Slf4j;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import com.techstar.ats.dxp.AtsMessage;
import com.techstar.ats.dxp.AtsResponse;

@Slf4j
public class CsvExportHandler extends ChannelInboundHandlerAdapter {

	public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
		AtsResponse atsResponse = (AtsResponse) msg;
		AtsMessage atsMessage = (AtsMessage) msg;
		log.info("{}: {}", String.format("0x%04x", atsMessage.id), atsResponse.toCsvString());
		super.channelRead(ctx, msg);
	}
}
